<template>
  <!-- 确认挂号信息 -->
  <div class="internal">
    <navbar :text="$route.params.text"></navbar>
    <div class="registration_information">
      <div class="visitor">
        <h1 class="title">请仔细确认挂号信息</h1>
        <div class="visitor_information">
          <h2 class="visitor_name">{{ visitor.name }}</h2>
          <p class="visitor_id number">
            <span>身份证号</span>
            <span>{{ num }}</span>
          </p>
          <p class="Visit_card_number number">
            <span>就诊卡号</span>
            <span>{{ visitor.bdcard }}</span>
          </p>
          <span class="switch_visitor" @click="switchAction()">切换就诊人</span>
        </div>
      </div>
      <div class="registration_details">
        <p>
          <span>就诊人</span>
          <span class="content">名字</span>
        </p>
        <p>
          <span>就诊科室</span>
          <span class="content">{{ order.department }}</span>
        </p>
        <p>
          <span>就诊日期</span>
          <span class="content">2022-{{ order.day }}</span>
        </p>
        <p>
          <span>就诊时间</span>
          <span class="content">
            <span>{{ order.period }} </span>
            <span> {{ order.timer }}</span>
          </span>
        </p>
        <p>
          <span>就诊医生</span>
          <span class="content">
            <span>{{ order.doctor }} </span>
            <span> {{ order.position }}</span>
          </span>
        </p>
        <p>
          <span>就诊地点</span>
          <span class="content">门诊楼一层201</span>
        </p>
      </div>
    </div>
    <div class="confirm">
      <span>医师服务费</span>
      <span class="price">{{ price }}</span>
      <button @click="confirmAction()">确认&nbsp;&nbsp;({{ price }})</button>
    </div>
  </div>
</template>

<script>
import navbar from "../../../components/navbar.vue";
import { mapState } from "vuex";
export default {
  components: {
    navbar,
  },
  data() {
    return {
      id: null,
    };
  },
  computed: {
    ...mapState("doctor", ["order", "price", "visitor"]),
    num() {
      let aa = this.visitor.idcard;
      let cc = aa.replace(aa.substring(6, 14), "********");
      return cc;
    },
  },
  methods: {
    // 确认，跳转去支付
    confirmAction() {
      this.$router.push({
        name: "Payment",
        params: { text: "支付" },
      });
    },
    // 切换就诊人
    switchAction() {
      this.$router.push({
        name: "SelectVisitor",
        params: { text: "选择就诊人" },
      });
    },
  },
  created() {
    console.log("---就诊人---", this.visitor);
    console.log(this.visitor.idcard);
  },
};
</script>

<style lang="scss" scoped>
@function vw($px) {
  @return ($px/375) * 100vw;
}
.registration_information {
  position: relative;
  z-index: 1;
  top: 46px;
  left: 0;
  height: calc(100% - vw(46));
  overflow: auto;
  &::-webkit-scrollbar {
    display: none;
  }
  .visitor {
    background-color: #2ec7c9;
    width: 100%;
    height: vw(152);
    font-family: "微软雅黑";
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
    position: relative;
    .title {
      color: #fff;
      padding-left: vw(30);
      padding-top: vw(45);
      box-sizing: border-box;
    }
    .visitor_information {
      position: absolute;
      background-color: #fff;
      width: vw(340);
      height: vw(133);
      top: vw(100);
      left: 50%;
      transform: translateX(-50%);
      border-radius: vw(5);
      padding-left: vw(35);
      box-sizing: border-box;
      font-size: vw(14);
      .visitor_name {
        font-family: "Arial-BoldMT", "Arial Bold", "Arial";
        font-weight: 700;
        font-style: normal;
        padding-bottom: vw(15);
        padding-top: vw(20);
        color: #000000;
      }
      .number {
        padding-bottom: vw(20);
        color: #999;
        span {
          padding-right: vw(20);
        }
      }
      .switch_visitor {
        position: absolute;
        background-color: #2ec7c9;
        color: #fff;
        padding: vw(5) vw(3);
        right: vw(10);
        top: vw(60);
        border-radius: vw(3);
        font-size: vw(13);
      }
    }
  }
  .registration_details {
    background-color: #fff;
    width: vw(340);
    height: vw(295);
    margin: 0 auto;
    margin-top: vw(90);
    margin-bottom: vw(100);
    padding-left: vw(35);
    padding-top: vw(30);
    box-sizing: border-box;

    p {
      padding-bottom: vw(30);
      font-family: "ArialMT", "Arial";
      font-weight: 400;
      font-size: vw(14);
      color: #000;
      position: relative;
      .content {
        position: absolute;
        left: vw(159);
      }
    }
  }
}

// 确认挂号
.confirm {
  position: fixed;
  bottom: 0;
  left: 0;
  background-color: #fff;
  width: 100%;
  height: vw(56);
  z-index: 1;
  font-size: vw(14);
  font-family: "ArialMT", "Arial";
  font-weight: 400;
  font-style: normal;
  color: #000;
  display: flex;
  align-items: center;
  padding-left: vw(30);
  box-sizing: border-box;
  span {
    padding-right: vw(25);
  }
  .price {
    color: #ed5d2a;
  }
  button {
    font-family: "微软雅黑";
    font-weight: 400;
    font-style: normal;
    font-size: vw(16);
    color: #ffffff;
    background-color: #2ec7c9;
    padding: vw(15) vw(10);
    border: none;
    border-radius: vw(5);
    position: absolute;
    right: vw(15);
  }
}
</style>
